/*
* 运输详情
* */
import 'package:center_beijing/config/global_config.dart';
import 'package:center_beijing/widgets/imagesWatch_widget2.dart';
import 'package:flutter/material.dart';
import 'package:center_beijing/common/styles.dart';
import 'package:center_beijing/common/utils.dart';
import 'package:get/get.dart';
import 'dart:convert';

class TransportDetail extends StatefulWidget {

  @override
  _TransportDetailState createState() => _TransportDetailState();
}

class _TransportDetailState extends State<TransportDetail> {
  var currentDetail = json.decode(Get.arguments['operateContentDetail']);
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text('运输详情'),
      ),
      body: SafeArea(
        child: Container(
          padding: EdgeInsets.fromLTRB(Styles.spacing16, Styles.spacing8, Styles.spacing16, Styles.spacing8),
          child: SingleChildScrollView(
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Container(
                  padding: EdgeInsets.fromLTRB(Styles.spacing8, Styles.spacing8, Styles.spacing8, Styles.spacing8),
                  child: Text("运输人  ${currentDetail['transportCar']['transportPerson']}",style: TextStyle(color: Styles.DetailColor,fontSize: Styles.NormalFont),),
                ),
                Container(
                  padding: EdgeInsets.fromLTRB(Styles.spacing8, Styles.spacing8, Styles.spacing8, Styles.spacing8),
                  child: Text("运输人手机号  ${currentDetail['transportCar']['mobilePhone']}",style: TextStyle(color: Styles.DetailColor,fontSize: Styles.NormalFont),),
                ),
                Container(
                  padding: EdgeInsets.fromLTRB(Styles.spacing8, Styles.spacing8, Styles.spacing8, Styles.spacing8),
                  child: Text("运输车牌号  ${currentDetail['transportCar']['vehicleNum']}",style: TextStyle(color: Styles.DetailColor,fontSize: Styles.NormalFont),),
                ),
                Container(
                  padding: EdgeInsets.fromLTRB(Styles.spacing8, Styles.spacing8, Styles.spacing8, Styles.spacing8),
                  child: Text("发货单号  ${currentDetail['sendNumber']}",style: TextStyle(color: Styles.DetailColor,fontSize: Styles.NormalFont),),
                ),
                Container(
                  padding: EdgeInsets.fromLTRB(Styles.spacing8, Styles.spacing8, Styles.spacing8, Styles.spacing8),
                  child: Text("客户  ${currentDetail['clientName']}",style: TextStyle(color: Styles.DetailColor,fontSize: Styles.NormalFont),),
                ),
                Container(
                  padding: EdgeInsets.fromLTRB(Styles.spacing8, Styles.spacing8, Styles.spacing8, Styles.spacing8),
                  child: Text("联系方式  ${currentDetail['linkManPhone']}",style: TextStyle(color: Styles.DetailColor,fontSize: Styles.NormalFont),),
                ),
                Container(
                  padding: EdgeInsets.fromLTRB(Styles.spacing8, Styles.spacing8, Styles.spacing8, Styles.spacing8),
                  child: Text("地址  ${currentDetail['clientAddress']}",style: TextStyle(color: Styles.DetailColor,fontSize: Styles.NormalFont),),
                ),
                currentDetail['attachments'] != null &&
                    currentDetail['attachments']
                        .length >
                        0
                    ? Column(
                  crossAxisAlignment:
                  CrossAxisAlignment
                      .start,
                  children: [
                    Container(
                      padding: EdgeInsets
                          .fromLTRB(
                          Styles.spacing8,
                          Styles
                              .spacing8,
                          Styles
                              .spacing8,
                          Styles
                              .spacing8),
                      child: Text(
                        '回执单',
                        style: TextStyle(
                            color: Styles
                                .DetailColor,
                            fontSize: Styles
                                .NormalFont),
                      ),
                    ),
                    ImagesWatchWidget2(
                      photos: currentDetail[
                      'attachments']
                          .map<String>(
                              (image) {
                            return "${GlobalConfig.baseUrl}fs/irest/file/mps_fileTransferHandler/image?id=${image['attachmentId']}&ZJQFSESSION=${GlobalConfig.session}";
                          }).toList(),
                    )
                  ],
                )
                    : Container(),
              ],
            ),
          ),
        ),
      ),
    );
  }
}
